package com.swk.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import com.swk.bean.Student;
import com.swk.util.JdbcUtils;

/**
 * 
 * @author 慎伟康
 * 
 * @date 2017年9月17日 上午7:04:00
 * 
 * @Description TODO
 *		学生相关dao
 */
public class StudentDao {
	
	/**
	 * 获取学生信息
	 * @param studentId
	 * @return
	 * @throws SQLException 
	 */
	public Student getStudentInfo(String studentId) throws SQLException{
		QueryRunner runner = new QueryRunner(JdbcUtils.getDataSource());
		String sql = "select * from student where studentId = ?";
		Student stu = runner.query(sql, new BeanHandler<Student>(Student.class), new Object[]{studentId});
		return stu;
	}
	
}
